using System;
using SuiteDemo;

namespace Microsoft.Mtool.GenSuites
{
	public class ATMSuite
	{
		#region TOKENS

		private static void InsertCard(object type)
		{
            SUT.IsError = false;
			//throw new NotImplementedException();
            CardType t;
            switch((int)type)
            {
                case 1: t = CardType.Deposit; break;
                case 2: t = CardType.Withdraw; break;
                case 3: t = CardType.Both; break;
                default: t = CardType.Invalid; break;
            }
            Card c = new Card(t, "1", 100.0);
            ATM.Instance.InsertCard(c);
            if (t == CardType.Invalid && !SUT.IsError) throw new Exception();
            if (t != CardType.Invalid && SUT.IsError) throw new Exception();
		}

		private static void EnterPswd(object pswd)
		{
            SUT.IsError = false;
			//throw new NotImplementedException();
            string s = pswd.ToString();
            ATM.Instance.EnterPswd(s);
            if (s.Equals("1") && SUT.IsError) throw new Exception();
            if (!s.Equals("1")){
                if (ATM.Instance.GetErrorCount() == 3 && !SUT.IsError) throw new Exception();
                if (ATM.Instance.GetErrorCount() != 3 && SUT.IsError) throw new Exception();
            }
		}

		private static void SelectCmd(object cmd)
		{
            SUT.IsError = false;
			//throw new NotImplementedException();
            CmdType t;
            if (cmd == "Withdraw") t = CmdType.Withdraw;
            else if (cmd == "Deposit") t = CmdType.Deposit;
            else t = CmdType.Invalid;
            ATM.Instance.SelectCmd(t);
            if (t == CmdType.Invalid && !SUT.IsError) throw new Exception();
            if (t != CmdType.Invalid && SUT.IsError) throw new Exception();
		}

		private static void InitATM(object type)
		{
            SUT.IsError = false;
            //throw new NotImplementedException();
            ATMType t;
            if ((string)type == "ABC") t = ATMType.ABC;
            else if ((string)type == "BOC") t = ATMType.BOC;
            else if ((string)type == "ICBC") t = ATMType.ICBC;
            else t = ATMType.Invalid;
            ATM.Instance = new ATM(t);
            if (SUT.IsError) throw new Exception();
		}

		private static void ExitATM()
		{
			//throw new NotImplementedException();
		}

		private static void ChangeCmd()
		{
			//throw new NotImplementedException();
		}

		private static void DoCmd(object number, object isNeg, object isLimit)
		{
            SUT.IsError = false;
			//throw new NotImplementedException();
            int num = (int)number;
            bool bIsNeg = (bool)isNeg;
            bool bIsLimit = (bool)isLimit;

            if (num < 0)
            {
                ATM.Instance.DoCmd(-100);
                if (!SUT.IsError) throw new Exception();
            }
            else if (num == 0)
            {
                ATM.Instance.DoCmd(0);
                if (!ATM.Instance.HasPermission() && !SUT.IsError) throw new Exception();
                if (ATM.Instance.HasPermission() && SUT.IsError) throw new Exception();
            }
            else
            {
                double sum = 100;
                if (bIsNeg) sum = Math.Max(sum, ATM.Instance.GetCard().GetBalance() + 1);
                if (bIsLimit) sum = Math.Max(sum, ATM.Instance.GetLimit() + 1);
                ATM.Instance.DoCmd(sum);

                if (ATM.Instance.GetCmdType() == CmdType.Withdraw)
                {
                    if ((!ATM.Instance.HasPermission() || bIsNeg || bIsLimit) && !SUT.IsError) throw new Exception();
                    if (ATM.Instance.HasPermission() && !bIsNeg && !bIsLimit && SUT.IsError) throw new Exception();
                }
                else
                {
                    if ((!ATM.Instance.HasPermission() || bIsLimit) && !SUT.IsError) throw new Exception();
                    if (ATM.Instance.HasPermission() && !bIsLimit && SUT.IsError) throw new Exception();
                }
            }
		}

		#endregion

		#region FUNCTIONS

		private static void TripleInvalidPswd()
		{
			EnterPswd(0);
			EnterPswd(0);
			EnterPswd(0);
		}

		#endregion

		#region VARIABLES

		private static object vctype;
		private static object cmd;
		private static object number;
		private static object isNeg;
		private static object isLimit;
		private static object atmtype;

		#endregion

		#region DEFAULT

		private static int errNum;
		private static int allNum;

		#endregion

		#region TEST CASES

        private static void TestCase_0_0()
        {
            try
            {
                InitATM(atmtype);
                InsertCard(0);

                Console.WriteLine("TestCase_0_0 is OK.");
            }
            catch (Exception e)
            {
                errNum++;
                Console.WriteLine("TestCase_0_0 is failed.");
            }
            finally
            {
                allNum++;
            }
        }

		private static void TestCase_0_1()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				TripleInvalidPswd();

				Console.WriteLine("TestCase_0_1 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_1 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_2()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(0);

				Console.WriteLine("TestCase_0_2 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_2 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_3()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				TripleInvalidPswd();

				Console.WriteLine("TestCase_0_3 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_3 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_4()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				ExitATM();

				Console.WriteLine("TestCase_0_4 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_4 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_5()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(0);

				Console.WriteLine("TestCase_0_5 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_5 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_6()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				DoCmd(number, isNeg, isLimit);
				ExitATM();

				Console.WriteLine("TestCase_0_6 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_6 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_7()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				ChangeCmd();
				SelectCmd(0);

				Console.WriteLine("TestCase_0_7 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_7 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_8()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(0);
				SelectCmd(cmd);
				ExitATM();

				Console.WriteLine("TestCase_0_8 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_8 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_9()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				ExitATM();

				Console.WriteLine("TestCase_0_9 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_9 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_10()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				DoCmd(number, isNeg, isLimit);
				ChangeCmd();
				SelectCmd(0);

				Console.WriteLine("TestCase_0_10 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_10 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_11()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(0);
				SelectCmd(cmd);
				DoCmd(number, isNeg, isLimit);
				ExitATM();

				Console.WriteLine("TestCase_0_11 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_11 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_12()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				DoCmd(number, isNeg, isLimit);
				ExitATM();

				Console.WriteLine("TestCase_0_12 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_12 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_13()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				ChangeCmd();
				SelectCmd(0);

				Console.WriteLine("TestCase_0_13 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_13 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_14()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(0);
				SelectCmd(cmd);
				ExitATM();

				Console.WriteLine("TestCase_0_14 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_14 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_15()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(cmd);
				DoCmd(number, isNeg, isLimit);
				ChangeCmd();
				SelectCmd(0);

				Console.WriteLine("TestCase_0_15 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_15 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		private static void TestCase_0_16()
		{
			try
			{
				InitATM(atmtype);
				InsertCard(0);
				InsertCard(vctype);
				EnterPswd(1);
				SelectCmd(0);
				SelectCmd(cmd);
				DoCmd(number, isNeg, isLimit);
				ExitATM();

				Console.WriteLine("TestCase_0_16 is OK.");
			}
			catch(Exception e)
			{
				errNum++;
				Console.WriteLine("TestCase_0_16 is failed.");
			}
			finally
			{
				allNum++;
			}
		}

		#endregion

		static void Main(string[] args)
		{
			errNum = 0; allNum = 0;

			Console.WriteLine("# Case 0");
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_0();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_1();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_2();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_3();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_4();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_5();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_6();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_7();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_8();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_9();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_10();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_11();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_12();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_13();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_14();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_15();
			vctype = 1;
			cmd = "Withdraw";
			number = 0;
			isNeg = false;
			isLimit = false;
			atmtype = "ICBC";
			TestCase_0_16();

			Console.WriteLine("# Case 1");
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_0();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_1();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_2();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_3();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_4();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_5();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_6();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_7();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_8();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_9();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_10();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_11();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_12();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_13();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_14();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_15();
			vctype = 2;
			cmd = "Deposit";
			number = -1;
			isNeg = true;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_16();

			Console.WriteLine("# Case 2");
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_0();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_1();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_2();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_3();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_4();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_5();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_6();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_7();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_8();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_9();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_10();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_11();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_12();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_13();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_14();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_15();
			vctype = 3;
			cmd = "Deposit";
			number = -1;
			isNeg = false;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_16();

			Console.WriteLine("# Case 3");
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_0();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_1();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_2();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_3();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_4();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_5();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_6();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_7();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_8();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_9();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_10();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_11();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_12();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_13();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_14();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_15();
			vctype = 2;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_16();

			Console.WriteLine("# Case 4");
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_0();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_1();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_2();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_3();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_4();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_5();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_6();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_7();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_8();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_9();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_10();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_11();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_12();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_13();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_14();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_15();
			vctype = 3;
			cmd = "Withdraw";
			number = 0;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_16();

			Console.WriteLine("# Case 5");
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_0();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_1();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_2();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_3();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_4();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_5();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_6();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_7();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_8();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_9();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_10();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_11();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_12();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_13();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_14();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_15();
			vctype = 1;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = true;
			atmtype = "ABC";
			TestCase_0_16();

			Console.WriteLine("# Case 6");
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_0();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_1();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_2();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_3();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_4();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_5();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_6();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_7();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_8();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_9();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_10();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_11();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_12();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_13();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_14();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_15();
			vctype = 1;
			cmd = "Withdraw";
			number = -1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_16();

			Console.WriteLine("# Case 7");
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_0();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_1();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_2();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_3();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_4();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_5();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_6();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_7();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_8();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_9();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_10();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_11();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_12();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_13();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_14();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_15();
			vctype = 2;
			cmd = "Deposit";
			number = 0;
			isNeg = true;
			isLimit = false;
			atmtype = "ABC";
			TestCase_0_16();

			Console.WriteLine("# Case 8");
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_0();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_1();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_2();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_3();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_4();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_5();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_6();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_7();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_8();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_9();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_10();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_11();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_12();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_13();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_14();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_15();
			vctype = 3;
			cmd = "Deposit";
			number = 1;
			isNeg = true;
			isLimit = false;
			atmtype = "BOC";
			TestCase_0_16();

			Console.WriteLine("# Case 9");
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_0();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_1();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_2();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_3();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_4();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_5();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_6();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_7();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_8();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_9();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_10();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_11();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_12();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_13();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_14();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_15();
			vctype = 3;
			cmd = "Withdraw";
			number = 1;
			isNeg = false;
			isLimit = true;
			atmtype = "ICBC";
			TestCase_0_16();

			Console.WriteLine("# Case 10");
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_0();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_1();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_2();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_3();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_4();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_5();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_6();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_7();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_8();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_9();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_10();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_11();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_12();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_13();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_14();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_15();
			vctype = 1;
			cmd = "Deposit";
			number = 0;
			isNeg = false;
			isLimit = true;
			atmtype = "BOC";
			TestCase_0_16();

			Console.WriteLine();
			Console.WriteLine("Finish Test:");
			Console.WriteLine("pass = {0}, error = {1}, total = {2}, passrate = {3}%.", allNum-errNum, errNum, allNum, (allNum == 0) ? 0 : 100-Convert.ToInt32(((errNum+0.0)/allNum)*100) );
			Console.WriteLine();
			Console.WriteLine("Press any key to exit...");
			Console.ReadLine();
		}
	}
}
